package 多线程.可重入锁;

public class ReentrantLock4Synchronized {
    public static void main(String[] args) {
        // 方式1
        Object o = new Object();
        synchronized (o){
            System.out.println("外层加锁");
            synchronized (o){
                System.out.println("内层加锁");
            }
        }
        // 方式2
        m1();
    }
    public static synchronized void m1() {
        m2();
    }
    public static synchronized void m2() {
        m3();
    }
    public static synchronized void m3() {
    }

}
